import {ElMessage} from 'element-plus'

export function toast(
    {
        title,
        duration = 2000,
        type = 'success',
        showClose = false,
        onClose
    }) {
    if (!title) return
    const options = {
        message:title,
        duration,
        type,
        showClose,
    }
    if (onClose && typeof onClose === 'function') {
        options.onClose = onClose
    }
    ElMessage(options)
}
